<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="../lib/react.js"></script>
  <script src="../lib/react-dom.js"></script>
  <script src="http://cdn.bootcss.com/babel-core/5.8.38/browser.min.js"></script>
</head>
<body>
  <div id="app"></div>

  <script type="text/babel">
    var Mycomponent = React.createClass({
      getInitialState() {
        console.log("1-->getInitialState");
        return {
          count: 1
        }
      },
      componentWillMount() {
        console.log("2-->componentWillMount");
      },
      componentDidMount() {
        console.log("3-->componentDidMount");
      },
      componentWillUpdate() {
        console.log("4-->componentWillUpdate");
      },
      componentDidUpdate() {
        console.log("5-->componentDidUpdate");
      },
      handleClick(event) {
        this.setState({
          count: this.state.count + 1
        })
      },
      render() {
        return <div>
          <span>{ this.state.count }</span>
          <button onClick={ this.handleClick }>按钮</button>
        </div>
      }
    })

    ReactDOM.render(
      <Mycomponent/>,
      document.getElementById("app")
    )
  </script>
</body>
</html>